package les.anagrama.util;

public class Score {
	private String player;
	private int score;
	private Level level;

	public Score(String player, int score, Level level) {
		this.score = score;
		this.player = player;
		this.level = level;
	}

	public String getPlayer() {
		return player;
	}

	public int getScore() {
		return score;
	}

	public Level getLevel() {
		return level;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((level == null) ? 0 : level.hashCode());
		result = prime * result + ((player == null) ? 0 : player.hashCode());
		result = prime * result + score;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Score other = (Score) obj;
		if (level != other.level)
			return false;
		if (player == null) {
			if (other.player != null)
				return false;
		} else if (!player.equals(other.player))
			return false;
		if (score != other.score)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return String.format("%d  --------------------  %s", score, player);
	}
}
